IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'spBoxes_Create')
	BEGIN
		PRINT 'Dropping Procedure spBoxes_Create'
		DROP  Procedure  spBoxes_Create
	END

GO

PRINT 'Creating Procedure spBoxes_Create'
GO
CREATE Procedure dbo.spBoxes_Create
	( 	  
	  @BoxStatus varchar(50) = null, 
		@BoxLocation varchar(50) = null, 
		@BoxWarehouse varchar(50) = null, 
		@LastTransactionUser_ID numeric(9,0) = null, 
		@LastTransactionDate DateTime = null
	)
AS
  /* 
    ------------------------------------------------------------------------------
    - Change History
    - --------------
    - Date          Description
    ------------------------------------------------------------------------------
    - 2007/11/02    Initial version created
    ------------------------------------------------------------------------------
  */

	-- Declare the required variables

	-- Create the required new record
	INSERT INTO Boxes
	  (
		BoxStatus,
			BoxLocation,
			BoxWarehouse,
			LastTransactionUser_ID,
			LastTransactionDate	  
	  )
	VALUES
	  (
		@BoxStatus,
			@BoxLocation,
			@BoxWarehouse,
			@LastTransactionUser_ID,
			@LastTransactionDate
	  )

	-- Handle any errors
	IF @@ERROR != 0
	BEGIN
		RAISERROR('spBoxes_Create: Unable to Insert a new Boxes', 10, 1)
		RETURN
	END

	-- Return the newly created ID
	SELECT	@@IDENTITY AS 'Boxes_ID'

	-- Return to calling method
	RETURN 

GO
